module.exports = {
  baseUrl: "./",
  outputDir: "tg",
  productionSourceMap: false,
  lintOnSave: false,
  configureWebpack: config => {
    // 开发环境和生产环境配置的区分
    if (process.env.NODE_ENV === "production") {
      // 生产环境的配置
      devtool: "cheap-module-source-map";
    } else {
      // 其它环境的配置
      devtool: "source-map";
    }
  },
  devServer: {
    port: 8888,
    disableHostCheck: true,
    proxy: {
      "/api": {
        target: "http://192.168.0.128:8085",
        changeOrigin: true,
        pathRewrite: {
          "^/api": ""
        }
      },
      "/index": {
        target: "https://www.easy-mock.com/mock/5d67859b913d395a83765e16/index",
        changeOrigin: true,
        pathRewrite: {
          "^/index": ""
        }
      },
      "/user": {
        target: "https://www.easy-mock.com/mock/5d67847804a1b7380fa0ab42/user",
        changeOrigin: true,
        pathRewrite: {
          "^/user": ""
        }
      },
      "/util": {
        target: "https://www.easy-mock.com/mock/5d67849e2c684c3be8426a6b/util",
        changeOrigin: true,
        pathRewrite: {
          "^/util": ""
        }
      },
      "/cec": {
        target: "https://www.easy-mock.com/mock/5d6784b99a0cbc3fd7c0ad29/cec",
        changeOrigin: true,
        pathRewrite: {
          "^/cec": ""
        }
      },
      "/otc": {
        target: "https://www.easy-mock.com/mock/5d6784d4b70d5943b1c7de8b/otc ",
        changeOrigin: true,
        pathRewrite: {
          "^/otc": ""
        }
      },
    }
  },
  chainWebpack: config => {
    rules: [
      {
        test: /\.less$/,
        loader: "style-loader!css-loader!less-loader"
      }
    ];
  },
};
